<?php

namespace app\utils\alarms;

use Throwable;

class AlarmsSupport implements AlarmsInterface
{
    /**
     * @param Throwable $throwable
     * @return void
     */
    public function push(Throwable $throwable): void
    {
        $this->getEngine()->push($throwable);
    }

    /**
     * @return AlarmsInterface
     */
    private function getEngine(): AlarmsInterface
    {
        $engine = config('alarms.engine');
        $class = config("alarms.{$engine}.class");
        return new $class;
    }

    /**
     * @param array $info
     * @param string $title
     * @return void
     */
    public function pushInfo(bool $isSuccess, array $info,string $title): void
    {
        $this->getEngine()->pushInfo($isSuccess,$info,$title);
    }
}
